﻿<!DOCTYPE>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, width=device-width, minimal-ui">
    <script src="/framework/angular-wang-editor/dist/js/lib/jquery-1.10.2.min.js" type="text/javascript"></script>
    <link href="/css/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        this.checkhHtml5 = function () {
            if (typeof (Worker) !== "undefined") { return true; } else { return false; }
            //        if (document.getElementById("Canvas_Tea").getContext && typeof (Worker) !== "undefined") { return true; } else { return false; }
        }

        var h5 = checkhHtml5(); // 0、
        if (!h5) {
            $("body").append("<div id=\'ErrShow\' class=\'Init\'>  <div style=\' text-align:center; margin:50px auto;padding:10px;\'>    <div class=\'liveerr-ico\' style=\' background:url(/images/live_ico.png) no-repeat scroll 0 -190px; margin-bottom:20px;\'>    </div>    <p style=\'font-size:2em;\' id=\'errtxt\'>前辈,是时候让这款浏览器退隐了，换个新的尝尝鲜吧！<br />要求:IE9及以上浏览器，或使用<a href='https://www.baidu.com/s?wd=Firefox'>Firefox</a>,<a href='https://www.baidu.com/s?wd=Chrome'>Chrome</a>或<a href='https://www.baidu.com/s?wd=safari'>Safari</a>,国产浏览器请切换至极速模式！</p>  </div></div>");
        }
    </script>
    <script src="/framework/angular.min.js"></script>
    <title>正在载入中...</title>     
    <style type="text/css">
        .jisuloading{position: fixed; height: 100%; width: 100%; top: 0; z-index:999; background: #fff;}
        .jisuloading .img {  position:absolute; margin:0 auto;width:320px; height:120px; top:50%; margin-top:-60px; text-align:center; left:50%; margin-left:-160px; }
    </style>
</head>
<body ng-app="ssoLogin">
    <div class="jisuloading" ng-controller="ssoCtrl">
            <div class="img">
                <img src="/images/yemianloding.gif" width="90" height="90" />
                <center ng-bind="errorinfo">
                    正在登入系统。。。
                </center>
            </div>
    </div>          
    <script src="/framework/lodash.min.js" type="text/javascript"></script>
    <script src="/framework/restangular/restangular.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/framework/angular-toastr/angular-toastr.min.js"></script>
    <script type="text/javascript" src="/framework/angular-toastr/angular-toastr.tpls.min.js"></script>
    <script src="/system/service/common.js" type="text/javascript"></script>
    <script type="text/javascript">

        var mainApp = angular.module("ssoLogin", ['Common']).config(['$locationProvider', function ($locationProvider) {
            $locationProvider.html5Mode({
                enabled: true,
                requireBase: false//必须配置为false，否则<base href=''>这种格式带base连接的地址才能解析
            });
        } ]);
        mainApp.controller('ssoCtrl', ['$scope', '$location', 'RequestUserService', 'sysUserInfo','Restangular', function ($scope, $location, RS, sysUserInfo,Restangular) {
            Restangular.addFullRequestInterceptor(function(element, operation, route, url, headers, params, httpConfig) {     
                    return {              
                        headers: {"Content-Type": "application/x-www-form-urlencoded;charset=utf-8"}  
                    };
                });
            $scope.errorinfo = "正在登入系统。。。";
            //手机判断
            var browser = {
                versions: function () {
                    var u = navigator.userAgent, app = navigator.appVersion;
                    return {         //移动终端浏览器版本信息
                        trident: u.indexOf('Trident') > -1, //IE内核
                        presto: u.indexOf('Presto') > -1, //opera内核
                        webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
                        gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
                        mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
                        ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
                        android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或uc浏览器
                        iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
                        iPad: u.indexOf('iPad') > -1, //是否iPad
                        wp: u.indexOf('IEMobile') > -1, //是否wp
                        symbianos: !!u.match(/SymbianOS.*/), //是否SymbianOS
                        webApp: u.indexOf('Safari') == -1 //是否web应该程序，没有头部与底部
                    };
                } (),
                language: (navigator.browserLanguage || navigator.language).toLowerCase()
            }


            $scope.token = $location.search().token;
            if ($scope.token == undefined || $scope.token == null || $scope.token == "") { //验证缺少参数
                $scope.errorinfo = "非法登入系统,我们已记录您的ip请重试。。。";
            } else {
                // 验证系统信息
                RS.ssoLoginTokenVerification({ token: $scope.token }).then(function (retobj) {
                    if (retobj.errorcode == 0) {
                        retobj.data.userId = retobj.data.user_ID;
                        retobj.data.username = retobj.data.user_Name;
                        if (retobj.data.user_Img == "" || retobj.data.user_Img == null || retobj.data.user_Img == undefined) {
                            retobj.data.user_Img = "/images/avatar.png";
                        }
                        sysUserInfo.setuserinfo(retobj.data);
                        sysUserInfo.setuserinfotoken($scope.token);
                        if (browser.versions.mobile || browser.versions.ios || browser.versions.android || browser.versions.symbianos || browser.versions.wp) {
							window.location.href = "/vue/index.html?H5ID="+retobj.data.organization_ID+"#/sso/" + retobj.data.user_ID+"/"+$scope.token;
                        } else {
                            window.location.href = "/member/index.html";
                        }
                    } else {
                        $scope.errorinfo = "登入系统失败！";
                    }
                });
            }
        } ]);
    </script>
    <script src="/system/service/userpathservice.js?v=1" type="text/javascript"></script>
</body>
</html>
